<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Vflight extends CI_Controller {
	public $user_data=array();
	
	function __construct()
     {
	     parent::__construct();
	     
		//不登陆的不让访问
		if (!$this->session->userdata('uadmin_in')){
			
			redirect('admin/home');
			exit();
		}
		
		$this->user_data["uadmin_name"] = $this->session->userdata('uadmin_name');
		$this->user_data["uadmin_userid"] = $this->session->userdata('uadmin_userid');
		$this->user_data["uadmin_account"] = $this->session->userdata('uadmin_account');
		$this->user_data["uadmin_hashcode"] = $this->session->userdata('uadmin_hashcode');
		$this->load->model('Order_model');

     }
     //虚拟航班管理
     public function index()
     {
     	$data=array();
		$data["title"]	="virtual Flight";
		
		$data["FlightDate1"]=Date("Y-m-d",time());
     	$this->load->view("admin/vflight/home",$data);
     }
     
     //增加虚拟航班步骤1
     public function addvflights1()
     {
     	$data=array();
		$data["title"]	="add virtual flight step one";
		$data["FlightDate1"]=Date("Y-m-d",time());
		
     	$this->load->view("admin/vflight/addvflights1",$data);
     }
     
     //修改虚拟航班步骤1
     public function editvflights1()
     {
     	$data=array();
		$data["title"]	="edit virtual flight step one";
		$data["FlightDate1"]=Date("Y-m-d",time());
		
     	$this->load->view("admin/vflight/editvflights1",$data);
     }

      //处理虚拟航班
    /* public function doaddvflight()
     {
		print_r($_POST);
     }*/

      //处理虚拟航班
     public function doaddvflight()
     {
     	$this->load->model("Vflight_model");
     	
     	$saveresult=$this->Vflight_model->addvFlight($_POST,$this->user_data);
     	
     	echo '<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>';
    		if($saveresult)
    		{
    			echo "Saved successfully";  
    		}else
    		{
				echo "<SCRIPT LANGUAGE=\"JavaScript\">";
				echo "alert(\"save fail\");";
				echo "</SCRIPT>";  
    		}
     }
     
      //处理虚拟航班
     public function doeditvflight()
     {
     	$this->load->model("Vflight_model");
     	
     	$saveresult=$this->Vflight_model->editvFlight($_POST,$this->user_data);
     	
     	echo '<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>';
    		if($saveresult)
    		{
    			echo "Saved successfully";  
    		}else
    		{
				echo "<SCRIPT LANGUAGE=\"JavaScript\">";
				echo "alert(\"save fail\");";
				echo "</SCRIPT>";  
    		}
     }

     //查询虚拟航班
     public function queryvflight()
     {
     	$this->load->model("Vflight_model");
     	
     	$data=array();
		$data["title"]	="query virtual flight";
		$data["FlightDate1"]=Date("Y-m-d",time());
		
		$result=$this->Vflight_model->queryvflight($_POST,$this->user_data);

		$data["result"]	=$result["result"];
		$data["iTotalCount"]=$result["TotalCount"];
		//print_r($data["result"]);
     	$this->load->view("admin/vflight/queryvflight",$data);
     }
     
      //查询虚拟航班的舱位信息
     public function queryvclass($sid)
     {
     	$this->load->model("Vflight_model");
     	
     	$data=array();
		$data["title"]	="query virtual flight";
		$data["FlightDate1"]=Date("Y-m-d",time());
		
		$data["result"]=$this->Vflight_model->queryvclass($sid,$this->user_data);
		
		
		$this->load->view("admin/vflight/queryvclass",$data);
     }
}

/* End of file home.php */
/* Location: ./application/controllers/home.php */

?>
